package api.business;


import common.BaseController;
import common.CommonResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import services.business.BusinessInfoServices;
import wt.entity.business.BusinessInfo;

/**
 * Created by Administrator on 2017/8/16.
 */
@Controller
@RequestMapping("httpApi")
public class GetBusinessInfoController extends BaseController {

    @Autowired
    BusinessInfoServices businessInfoServices;


    /**
     * 查询业务是否已经存在。
     * @param businessCode
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping(value = "getBusinessInfo", produces = "application/json;charset=UTF-8")
    public CommonResult addBusinessInfo(String businessCode) throws Exception {

        BusinessInfo businessInfo=null;
        if (!StringUtils.isBlank(businessCode)) {
            businessInfo= businessInfoServices.selectByBusinessCode(businessCode);
        }
        CommonResult commonResult=new CommonResult();
        commonResult.setMessage(CommonResult.ZJ001_M);
        commonResult.setCode(CommonResult.ZJ001);
        commonResult.setData(businessInfo);
        return commonResult;
    }


}
